home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / hypercrd / hc2_x / tcprogud.sit / TC Prog Guide / card_58754.txt < prev    next >
Text File  |  1991-02-27  |  1KB  |  39 lines

  1. -- card: 58754 from stack: in
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 4755
  5. -- name: 
  6.  
  7.  
  8. -- part contents for background part 4
  9. ----- text -----
  10. The size_t type is defined in stdlib.h and is typically an unsigned long integer.  The malloc() function returns a pointer to a block of memory of the desired size.  This is a   'void' pointer, meaning that it may be assigned to a pointer of any type.
  11.  
  12. The number of bytes required is frequently determined using the 'sizeof' operator, which evaluates the number of bytes required by its operand.  An example using the personnel_rec user-defined type discussed earlier* is:
  13.  
  14.     # include   <stdlib.h>
  15.                .
  16.                .
  17.         struct personnel_rec   *person_ptr;
  18.         person_ptr = (struct personnel_rec*) malloc(sizeof (struct personnel_rec));
  19.                .
  20.                .
  21.         free(person_ptr);
  22.  
  23. The free() function deallocates the space pointed to by its argument.
  24.  
  25. -- part contents for background part 7
  26. ----- text -----
  27. 198
  28.  
  29. -- part contents for background part 29
  30. ----- text -----
  31. 25150
  32.  
  33. -- part contents for background part 27
  34. ----- text -----
  35. personnel_rec structure
  36.  
  37. -- part contents for background part 20
  38. ----- text -----
  39. personnel_rec structure - p66